#ifndef DYNAMICPROGRAMMING_H
#define DYNAMICPROGRAMMING_H
#include <iostream>

using namespace std;

class DynamicProgramming
{
public:
    DynamicProgramming();
    ~DynamicProgramming(){}

    /* 爬台阶问题
       问题描述：一个人爬楼梯，每次只能爬1个或2个台阶，假设有n个台阶，那么这个人有多少种不同的爬楼梯方法？
    */
    int f(int n)
    {
        if(n == 1) return 1;
        if(n == 2) return 2;
        int a = 1;
        int b = 2;
        int temp = a + b;
        for (int i = 3; i <=n; i++) {
            temp = a + b;
            a = b;
            b = temp;

        }
        return temp;
    }
};

void testDynamicProgramming();

#endif // DYNAMICPROGRAMMING_H
